<?
if(isset($_POST['submitted']))
{
	
	// 폴더 생성
	$prjName = trim($_POST['prjName']);
	$prjCodename = trim($_POST['prjCodename']);
	$prjType = trim($_POST['prjType']);
	$prjType = trim($_POST['prjStatus']);
	$prjDesc = $_POST['prjDesc'];

	echo "<script>alert('$prjName' + '이 생성되었습니다.');</script>";
	echo "$prjName";
	echo "$prjCodename";
	echo "$prjType";
	echo "$prjDesc";
	include('db_connect.php');
	$query = "insert into project(prjName, prjCodename, prjType, prjStatus, prjDesc) values
					('$prjName', '$prjCodename', '$prjType', '$prjStatus', '$prjDesc')";
	$result = mysql_query($query);
	exec("folderMaker.py $prjCodename");
}
?>

<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<script type="text/javascript">
<!--
function inputCheck(form)
{
	if(!form.prjName.value)
	{
		alert("프로젝트 이름을 입력하세요");
		form.prjName.focus();
		return false;	
	}
	if(!form.prjCodename.value)
	{
		alert("코드네임을 입력하세요");
		form.prjCodename.focus();
		return false;	
	}
	if(form.prjType.value == '0')
	{
		alert("타입을 선택하세요");
		form.prjType.focus();
		return false;	
	}
	if(form.prjStatus.value == '0')
	{
		alert("진행 상태를 선택하세요");
		form.prjStatus.focus();
		return false;	
	}
	return true;
}
//-->
</script>


</head>
<body>
<form method="post" action="projectSetUp.php" onsubmit="return inputCheck(this)">
<h><b>PAPYRUS PROJECT SET UP</h></b>
<!--HTML-->
<table border=1>
<tr><td>Name	</td>
	<td><input type="text" name="prjName"></td></tr>
<tr><td>CodeName</td>
	<td><input type="text" name="prjCodename"></td></tr>
<tr><td>Type</td>
	<td><select name="prjType">
		<option value="0" selected>선택하세요
		<option value="Teaser">Teaser
		<option value="Film">Film
		<option value="Commercial">Commercial
		<option value="TV">TV
		<option value="MISC">MISC
	</select></td></tr>
<tr><td>Status</td>
	<td><select name="prjStatus">
		<option value="0" selected>선택하세요
		<option value="Active">Active
		<option value="Bidding">Bidding
		<option value="Hold">Hold
		<option value="Cancel">Cancel
		<option value="Completion">Completion
	</select></td></tr>
<tr><td>Description</td>
	<td><textarea name="prjDesc" rows="10" cols="30"></textarea></td></tr>
<tr><td></td><td><input type="submit" name="submitted" value="SET UP"></td></tr>
</table>
</form>
</body>
</html>